#include <iostream>
#include <memory>
#include "InertAddr.hpp"
#include "Log.hpp"
#include "Route.hpp"
#include "UdpServer.hpp"
using namespace LogModule;
int main(int argc, char *argv[])
{
    if (argc < 2)
    {
        LOG(LogLevel::FATAL) << "input error";
        return 1;
    }
    std::string port = argv[1];

    // 路由
    Route rt; // 进行分装只负责路由这一步

    // 通信
    std::unique_ptr<UdpServer> us = std::make_unique<UdpServer>(stoi(port), [&](int socketfd, std::string message, InertAddr client)
                                                                { rt.MessageRoute(socketfd, message, client); });

    us->Init();
    us->Start();
    return 0;
}